package com.niit.onlinemusicserver.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.niit.onlinemusicserver.common.R;
import com.niit.onlinemusicserver.model.domain.Consumer;
import com.niit.onlinemusicserver.model.request.ConsumerRequest;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpSession;
import java.util.List;

public interface ConsumerService extends IService<Consumer> {
  R allUser(IPage page);
  R deleteUser(Integer id);

  R deleteUsers(String[] id);
  //根据用户id获取Consumer
  R userOfId(Integer id);

  //获取所有用户
  R allUsers();
  //密码验证
  boolean verityPasswd(String username, String password);
  //登录验证
  R loginStatus(ConsumerRequest loginRequest, HttpSession session);

  boolean existUser(String username);
  //用户注册
  R addUser(ConsumerRequest registryRequest);

  //用户资料修改
  R updateUserMsg(ConsumerRequest updateRequest);
  //更新用户图像
  R updateUserAvator(MultipartFile avatorFile, int id);

  //更新密码
  R updatePassword(ConsumerRequest updatePasswordRequest);

  /**
   * 验证注册或登录时 手机号是否存在
   * @param phoneNum
   */
  boolean existUserByPhone(String phoneNum);

  /**
   * 邮箱验证
   * @param recipientEmail
   * @return
   */
  boolean existUserByEmail(String recipientEmail);

  Consumer getOneByUserName(String username);

  boolean insert(Consumer consumer);

  /** 获取所有用户ID */
  List<Integer> getAllUserIds();
}